<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-model</title>
</head>
<body>
<div id="app">
  <div>
    <label>年龄</label>
    <input v-model="age">
  </div>
  <div>当前输入的年龄是: {{age}}</div>
  <button @click="add">加一岁</button>
  <button @click="consoleYear">控制台打印年龄</button>
</div>

<script src="vue.global.js"></script>
<script>
  const App = {
    data(){
      return {
        age: 20,
      }
    },
    methods: {
      add(){
        this.age++
      },
      consoleYear(){
        console.log(this.age)
      }
    }
  }

  const vm = Vue.createApp(App).mount('#app');
  console.log(vm)
</script>
</body>
</html>
